<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>homework1</title>
</head>
<body>
<pre>
      # -*- coding: utf-8 -*-
import time
def fac(n):
 result = 1
 while n > 0:
 result *= n
 n -= 1
 return result

def main(n):
 for x in range(1, n + 1):
 start = time.time()
 result = fac(x)
 end = time.time()
 print('当 n = {} 时，结果为：{}，耗时为：{} 秒'.format(x, result, end -
start))
if __name__ == '__main__':
 main(100)
    </pre>
</body>
</html>